package com.starsoft.trade.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.starsoft.frame.base.bean.BaseAcount;
import com.starsoft.frame.core.orm.BaseDao;
import com.starsoft.trade.bean.TradeAcount;

@Repository
public class TradeAcountDao extends BaseDao<TradeAcount, Integer> {

	public List<BaseAcount> getRealAcountByUser(Integer userId) {
		String hql = "from BaseAcount as a where userId =:userId and  exists(select 1 from TradeAcount as b "
				+ "where  realAcount=true and a.acountId = b.acountId)";
		Map<String, Object> params = new HashMap<>();
		params.put("userId", userId);
		return findByMap(hql, params);
	}

}
